import { mapAdaptor, mapDefaultOption }  from "mars-pro/packages/pro-data-g2plot/src/plot/map";
import { mapAdaptor as mapAdaptor1, mapDefaultOption as mapDefaultOption1}  from "mars-pro/packages/pro-data-g2plot/src/plot/point-map";
// 行业相关数据
const chart1 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _title: "行业相关数据",
            _height: 300,
            _span: 24,
            _plot: "DualAxes",
            option: {
                data: [[], []],
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column',
                        lineStyle: {
                            lineWidth: 3,
                            lineDash: [5, 5],
                        },
                        mapping: {
                            size: 20,
                        },
                        annotations: [],
                    },
                    {
                        geometry: 'line',
                        smooth: true,
                    },
                ],
                meta: {
                    label: {
                        alias: '月份',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '100城(万㎡)',
                        sync: true,
                        formatter(value) {
                            return `${value}万㎡`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '环比变化',
                        formatter(value) {
                            return `${value}%`
                        }
                    },
                },
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
        //
        {
            _name: "chart2",
            _title: "房地产企业销售业绩TOP5（截止2023年4月30日）",
            _height: 250,
            _plot: "Table",
            option: {
                gutter: 40,
                data: [],
                group: [{
                    columns: [
                        { prop: "sort", label: "排名", width: "50px" },
                        { prop: "label", label: "企业名称" },
                        { prop: "value", label: "销售金额(亿元)" },
                    ]
                }, {
                    columns: [
                        { prop: "sort", label: "排名", width: "50px" },
                        { prop: "label", label: "企业名称" },
                        { prop: "value2", label: "销售面积((万㎡))" },
                    ]
                }],
            }
        }
    ]
}
// 行业经营数据
const chart2 = {
    columnCount: 3,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _title: "房地产新增面积",
            _height: 300,
            _plot: "Column",
            // plot配置
            option: {
                legend: {
                    position: 'bottom'
                },
                marginRatio: 0,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        alias: '房地产新增面积',
                        formatter(value) {
                            return `${value}万㎡`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(万㎡)',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['rgba(91, 113, 252, 1)', 'rgba(75, 201, 197, 1)', 'rgba(248, 159, 0, 1)'],
            }
        },
        {
            _name: "chart2",
            _title: "房地产销售面积",
            _height: 300,
            _plot: "Column",
            // plot配置
            option: {
                legend: {
                    position: 'bottom'
                },
                color: ['rgba(91, 113, 252, 1)', 'rgba(75, 201, 197, 1)', 'rgba(248, 159, 0, 1)'],
                marginRatio: 0,
                data: [],
                seriesField: 'type',
                xField: "label",
                isGroup: true,
                yField: "value",
                meta: {
                    value: {
                        alias: '房地产销售面积',
                        formatter(value) {
                            return `${value}万㎡`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(万㎡)',
                        position: 'end',
                        autoRotate: false
                    }
                },
            }
        },
        {
            _name: "chart3",
            _title: "房地产库存面积",
            _height: 300,
            _plot: "Column",
            // plot配置
            option: {
                legend: {
                    position: 'bottom'
                },
                color: ['rgba(91, 113, 252, 1)', 'rgba(75, 201, 197, 1)', 'rgba(248, 159, 0, 1)'],
                marginRatio: 0,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        alias: '房地产库存面积',
                        formatter(value) {
                            return `${value}万㎡`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(万㎡)',
                        position: 'end',
                        autoRotate: false
                    },
                },
            }
        }
    ]
}

// 全行业分析-盈利能力
const chart3 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "DualAxes",
            option: {
                data: [[], []],
                legend: {
                    position: 'top'
                },
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column',
                        lineStyle: {
                            lineWidth: 3,
                            lineDash: [5, 5],
                        },
                        mapping: {
                            size: 20,
                        },
                        annotations: [],
                    },
                    {
                        geometry: 'line',
                        smooth: true,
                        seriesField: 'type',
                    },
                ],
                meta: {
                    label: {
                        alias: '年',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '营业收入',
                        sync: true,
                        formatter(value) {
                            return `${value}亿`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '%',
                        formatter(value) {
                            return `${value}%`
                        }
                    },
                },
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 全行业分析 - 营运能力
const chart4 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "DualAxes",
            option: {
                data: [[], []],
                legend: {
                    position: 'top'
                },
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column',
                        lineStyle: {
                            lineWidth: 3,
                            lineDash: [5, 5],
                        },
                        mapping: {
                            size: 20,
                        },
                        annotations: [],
                    },
                    {
                        geometry: 'line',
                        smooth: true,
                        seriesField: 'type',
                    },
                ],
                meta: {
                    label: {
                        alias: '年',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '营业收入',
                        sync: true,
                        formatter(value) {
                            return `${value}亿`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '%',
                        formatter(value) {
                            return `${value}%`
                        }
                    },
                },
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定`
        },
    ]
}

// 全行业分析 - 偿债能力
const chart5 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "DualAxes",
            option: {
                data: [[], []],
                legend: {
                    position: 'top'
                },
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column',
                        lineStyle: {
                            lineWidth: 3,
                            lineDash: [5, 5],
                        },
                        mapping: {
                            size: 20,
                        },
                        annotations: [],
                    },
                    {
                        geometry: 'line',
                        smooth: true,
                        seriesField: 'type',
                    },
                ],
                meta: {
                    label: {
                        alias: '年',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '营业收入',
                        sync: true,
                        formatter(value) {
                            return `${value}亿`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '倍',
                        formatter(value) {
                            return `${value}倍`
                        }
                    },
                },
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

//全行业分析 - 成长能力
const chart6 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "DualAxes",
            option: {
                data: [[], []],
                legend: {
                    position: 'top'
                },
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column',
                        lineStyle: {
                            lineWidth: 3,
                            lineDash: [5, 5],
                        },
                        mapping: {
                            size: 20,
                        },
                        annotations: [],
                    },
                    {
                        geometry: 'line',
                        smooth: true,
                    },
                ],
                meta: {
                    label: {
                        alias: '年',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '归母净利润',
                        sync: true,
                        formatter(value) {
                            return `${value}亿`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '同比',
                        formatter(value) {
                            return `${value}%`
                        }
                    },
                },
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 龙头企业分析 - 盈利能力
const chart7 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "Column",
            // plot配置
            option: {
                legend: {
                    position: 'top'
                },
                marginRatio: 0,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        // alias: '房地产新增面积',
                        formatter(value) {
                            return `${value}k`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(亿元)',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['#4962FC', '#4BC9C5', '#FFDB73', '#94ABDC', '#FF6060'],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 龙头企业分析 - 营运能力
const chart8 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "Line",
            // plot配置
            option: {
                legend: {
                    position: 'top'
                },
                marginRatio: 0,
                smooth: true,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        // alias: '房地产新增面积',
                        formatter(value) {
                            return `${value}%`
                        },
                        range: [0, 0.90]
                    },
                    label: {
                        range: [0.01, 0.90]
                    }
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(%)',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['#4962FC', '#4BC9C5', '#FFDB73', '#94ABDC', '#FF6060'],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 龙头企业分析 -  偿债能力
const chart9 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "Line",
            // plot配置
            option: {
                legend: {
                    position: 'top'
                },
                marginRatio: 0,
                smooth: true,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        formatter(value) {
                            return `${value}%`
                        },
                        range: [0, 0.90]
                    },
                    label: {
                        range: [0.01, 0.90]
                    }
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(%)',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['#4962FC', '#4BC9C5', '#FFDB73', '#94ABDC', '#FF6060'],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 龙头企业分析 - 成长能力
const chart10 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "Column",
            option: {
                legend: {
                    position: 'top'
                },
                marginRatio: 0,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        // alias: '房地产新增面积',
                        formatter(value) {
                            return `${value}k`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '(亿元)',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['#4962FC', '#4BC9C5', '#FFDB73', '#94ABDC', '#FF6060'],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
    ]
}

// 资产负债表详情
const chart11 = {
    columnCount: 1,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _plot: "Line",
            option: {

                smooth: true,
                data: [],
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        alias: '增长率',
                        formatter(value) {
                            return `${value}%`
                        },
                        range: [0, 0.90]
                    },
                    label: {
                        range: [0.01, 0.90]
                    }
                },
                yAxis: {
                    tickCount: 6
                }
            }
        },
    ]
}


// 房地产行业 图表定义
const chart12 = {
    columnCount: 1,
    gutter: 10,
    regions: [
        {
            _name: "chart1",
            _height: 300,
            _title: '近五年房地产行业投资趋势',
            _plot: "DualAxes",
            option: {
                data: [[], []],
                legend: {
                    position: 'bottom'
                },
                xField: "label",
                yField: ["value", "value2"],
                geometryOptions: [
                    {
                        geometry: 'column'
                    },
                    {
                        geometry: 'line',
                        smooth: true
                    },
                ],
                meta: {
                    label: {
                        alias: '年',
                        range: [0.05, 0.95],
                    },
                    value: {
                        tickCount: 6,
                        nice: true,
                        alias: '金额（￥百万）',
                        sync: true,
                        formatter(value) {
                            return `${value}`
                        }
                    },
                    value2: {
                        tickCount: 6,
                        sync: true,
                        nice: true,
                        alias: '案例数(个)',
                        formatter(value) {
                            return `${value}`
                        }
                    },
                },
                yAxis: [
                    {
                        tickCount: 6,
                        title: {
                            text: '(亿元)',
                            position: 'end',
                            autoRotate: false
                        }
                    },
                    {
                        tickCount: 6,
                        title: {
                            text: '(个)',
                            position: 'end',
                            autoRotate: false
                        }
                    }
                ],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
        {
            _name: "chart2",
            _height: 300,
            _plot: "Column",
            _title: '近五年投资金额情况 -（老股权转让轮-房地产）',
            option: {
                legend: {
                    position: 'bottom'
                },
                marginRatio: 0,
                data: [],
                isGroup: true,
                seriesField: 'type',
                xField: "label",
                yField: "value",
                meta: {
                    value: {
                        formatter(value) {
                            return `${value}`
                        },
                        range: [0, 0.90]
                    },
                },
                yAxis: {
                    tickCount: 6,
                    title: {
                        text: '金额（￥百万）',
                        position: 'end',
                        autoRotate: false
                    }
                },
                color: ['#4962FC', '#4BC9C5', '#FFDB73'],
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
        {
            _name: "chart3111",
            _height: 400,
            _plot: "Pie",
            _title: '融资阶段统计',
            option: {
                appendPadding: 20,
                data: [],
                innerRadius: 0.6,
                angleField: 'value',
                colorField: 'label',
                legend: {
                    offsetX: -100,
                    title: {
                        text: '(单位*百万): '
                    },
                    // itemValue:{
                    //     formatter(v, item){
                    //         return `: ${item.value}`
                    //     }
                    // }
                },
                label: {
                    type: 'outer',
                    // '{name} {percentage} {value}'
                    content: '{value}({percentage})',
                },
                interactions: [{ type: 'element-selected' }, { type: 'element-active' }],
                statistic: {
                    title: false,
                    content: false
                }
            },
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
        {
            _name: "chart4",
            _height: 450,
            _width: '70%',
            _span: 24,
            _plot: "P",
            _title: '投融资区域分布',
            option: [
                {
                    data: [],
                    autoFit: true,
                    legend: {
                        position: 'right-bottom'
                    },
                    tooltip:{
                        title:'name',
                        showMarkers: false
                    }
                },
                mapAdaptor,
                mapDefaultOption
            ],
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        },
        {
            _name: "chart5",
            _height: 450,
            _width: '70%',
            _span: 24,
            _plot: "P",
            _title: '投融资区域分布1',
            option: [
                {
                    data: [
                        { name: "北京", value: 0, add: 10 },
                        { name: "天津", value: 0, add: 11 },
                        { name: "河北", value: 0, add: 12 },
                        { name: "山西", value: 0, add: 13 },
                        { name: "内蒙古", value: 0, add: 14 },
                        { name: "辽宁", value: 0, add: 15 },
                        { name: "吉林", value: 0, add: 16 },
                        { name: "黑龙江", value: 0, add: 17 },
                        { name: "上海", value: 0, add: 18 },
                        { name: "江苏", value: 0, add: 19 },
                        { name: "浙江", value: 0, add: 20 },
                        { name: "安徽", value: 0, add: 21 },
                        { name: "福建", value: 0, add: 22 },
                        { name: "江西", value: 0, add: 23 },
                        { name: "山东", value: 0, add: 24 },
                        { name: "河南", value: 0, add: 25 },
                        { name: "湖北", value: 0, add: 26 },
                        { name: "湖南", value: 0, add: 27 },
                        { name: "广东", value: 0, add: 28 },
                        { name: "广西", value: 0, add: 29 },
                        { name: "海南", value: 0, add: 30 },
                        { name: "重庆", value: 0, add: 31 },
                        { name: "四川", value: 0, add: 32 },
                        { name: "贵州", value: 0, add: 33 },
                        { name: "云南", value: 0, add: 34 },
                        { name: "西藏", value: 0, add: 35 },
                        { name: "陕西", value: 0, add: 36 },
                        { name: "甘肃", value: 0, add: 37 },
                        { name: "青海", value: 0, add: 38 },
                        { name: "宁夏", value: 0, add: 39 },
                        { name: "新疆", value: 0, add: 40 },
                        { name: "台湾", value: 0, add: 41 },
                        { name: "香港", value: 0, add: 42 },
                        { name: "澳门", value: 0, add: 43 },
                        { name: "十段线", value: 0, add: 44 },
                        { name: "南海诸岛", value: 0, add: 45 }
                    ].map((r, index) => {
                        return {
                            ...r,
                            value: index > 10 ? 0 : ((Math.random() * 30) | 0) + 5
                        }
                    }),
                    autoFit: true,
                    legend: false,
                    tooltip:{
                        title:'name',
                        showMarkers: false
                    }
                },
                mapAdaptor1,
                mapDefaultOption1
            ],
            describe: `房地产行业2023年市盈率中位数为 26.7，其中2月份数值低于全年平均值；市净率中位数为 1.8，数据比较稳定。`
        }
    ]
}


export default {
    columnCount: 2,
    gutter: 10,
    regions: [
        ...(chart1.regions),
        ...(chart2.regions),
        ...(chart3.regions),
        ...(chart4.regions),
        ...(chart5.regions),
        ...(chart6.regions),
        ...(chart7.regions),
        ...(chart8.regions),
        ...(chart9.regions),
        ...(chart10.regions),
        ...(chart11.regions),
        ...(chart12.regions),
    ]
}


